package com.yangguang.huahui.ui.adapters;

import android.widget.ImageView;

import com.yangguang.huahui.R;
import com.yangguang.huahui.baseadapter.BaseQuickAdapter;
import com.yangguang.huahui.baseadapter.BaseViewHolder;
import com.yangguang.huahui.entity.Reply;
import com.yangguang.huahui.utils.CommonUtil;
import com.yangguang.huahui.utils.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2017/4/1.
 */

public class QuestionListAdapter extends BaseQuickAdapter<Reply.ListBean> {

    public QuestionListAdapter(int layoutResId, List<Reply.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Reply.ListBean item) {
        helper.setText(R.id.tv_title, item.getTitle());
        if (!CommonUtil.isNull(item.getIcon())){
            helper.setVisible(R.id.iv_description, true);
            ImageLoader.load(mContext, item.getIcon(), (ImageView) helper.getView(R.id.iv_description), R.mipmap.home_load_error);
        }else {
            helper.setVisible(R.id.iv_description, false);
        }
        helper.setText(R.id.tv_description, item.getContent());
        helper.setText(R.id.tv_address, item.getPosition());
        helper.setText(R.id.tv_answer, item.getNum()+"个回答");
    }
}
